如何在Windows上设置Java,JRE和JDK主页路径和环境变量? |
您所在的位置:网站首页 › jre和jdk jvm › 如何在Windows上设置Java,JRE和JDK主页路径和环境变量? |
Java is a very popular programming language which provides a different component in order to run, develop Java applications. JRE or Java Runtime Environment is used to run Java application. JDK or Java Development Kit is used to develop Java applications. In this tutorial, we will learn how to set up Java, JRE, and JDK operating system path variables in order to work properly. Java是一种非常流行的编程语言,它提供了不同的组件来运行,开发Java应用程序。 JRE或Java Runtime Environment用于运行Java应用程序。 JDK或Java开发工具包用于开发Java应用程序。 在本教程中,我们将学习如何设置Java,JRE和JDK操作系统路径变量以使其正常工作。 找到JRE或JDK路径 (Locate JRE or JDK Path)Before starting the configuration we have to locate the JRE or JDK path. JRE or JDK generally installed on the Program Files or Program Files(x86) directory under the Java directory like below. 在开始配置之前,我们必须找到JRE或JDK路径。 JRE或JDK通常安装在Java目录下的Program Files或Program Files(x86)目录下,如下所示。 ![]() and under the Java directory the JDK is residing. JDK驻留在Java目录下。 ![]() Now we have learned the path of the Java, JRE or JDK installation. We can set this path as Java HOME_PATH environment variable. We will open the computer properties with by running sysdm.cpl in the Run menu like below. We can also open it from the File Explorer -> Computer -> Right Click. 现在,我们已经了解了Java,JRE或JDK安装的路径。 我们可以将此路径设置为Java HOME_PATH环境变量。 我们将通过在“运行”菜单中运行sysdm.cpl来打开计算机属性,如下所示。 我们也可以从文件资源管理器->计算机->右键单击打开它。 ![]() In the system properties, we will navigate to the Advanced tab which provides the Environment Variables button like below. 在系统属性中,我们将导航到“ Advanced选项卡,其中提供了“ Environment Variables按钮,如下所示。 ![]() Below we can see the environment variables menu where we will create the JAVA_HOME system variable and set the path accordingly. We click to the New in order to create a new system variable. 在下面我们可以看到环境变量菜单,在该菜单中我们将创建JAVA_HOME系统变量并相应地设置路径。 我们单击“ New以创建一个新的系统变量。 ![]() Here we will set the Variable Name as JAVA_HOME and the Variable Value the path or Java, JRE or JDK which is C:\Program Files\Java\jdk-12 in this example. Then we will click OK. 在此示例中,我们将Variable Name设置为JAVA_HOME , Variable Value为路径或Java,JRE或JDK,在此示例中为C:\Program Files\Java\jdk-12 。 然后,我们将单击“确定”。 LEARN MORE How To Download, Install Android Studio On Windows? 了解更多信息如何在Windows上下载并安装Android Studio?![]() If we want to run java.exe or similar executables provided by JRE or JDK we have to add the path of Java in the Path variable like below. We select the system variable named Path and click to the Edit. 如果我们要运行JRE或JDK提供的java.exe或类似的可执行文件,我们必须在如下所示的Path变量中添加Java的Path 。 我们选择名为Path的系统变量,然后单击Edit 。 ![]() Here we click to New which will add a new line to the existing values. 在这里,我们单击“ New ,这将向现有值添加新行。 ![]() Here we will set the bin folder path which is C:\Program Files\Java\jdk-12\bin in this example. 在此示例中,我们将设置bin文件夹路径,该路径为C:\Program Files\Java\jdk-12\bin 。 ![]() Then we will click OK and OK in the environment variables screen which will save and activated new path configuration. 然后,我们将在环境变量屏幕中单击OK和OK ,这将保存并激活新的路径配置。 检查Java是否正常工作 (Check Java Is Working)We can check the new path configuration simply opening a new command line interface MS-DOS. Then just type java -version which will execute java.exe with the -version option. We can see the current java binary version by running it. 我们只需打开新的命令行界面MS-DOS就可以检查新的路径配置。 然后只需键入java -version使用-version选项执行java.exe 。 通过运行它,我们可以看到当前的Java二进制版本。 ![]() 翻译自: https://www.poftut.com/how-to-set-java-jre-and-jdk-home-path-and-environment-variables-on-windows/ |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |